/******************************************************************************************
 * Import
 ******************************************************************************************/

// module
import React, {Component} from 'react';
import {View, Dimensions } from 'react-native';
import { Button, Modal, Icon } from 'antd-mobile-rn';

// project
import {
    CAround, CBetween, CCenter, CColumn, CHand, CItemX, CItemY, CLine, CRow, CWrap, 
    CIcon, CImage, CSvg, CText,
    CContent, CFloat, CFooter, CHeader, CPage, CSide, 
    CEmpty, CError, CFail, CSkeleton, 
    CLabel, CButton
} from '../../../../library/comp';



/******************************************************************************************
 * Export Class
 ******************************************************************************************/

export default class UserSettingCarDetail extends Component {

    /*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
    constructor(props) {
        super(props);
        // this.Nav = this.props.navigation;
        /**
         * state
         */
        this.state = {
            data:{
                set_number:"FVVV车牌号码"
            },
        };
    }

    /**
     * didMount
     */
    componentDidMount(){
        // http请求
        // HttpTemp.get({
        //     url:"/CPage/mycar/detail.php",
        //     data: {
        //         id: this.props.navigation.getParam('id')
        //     },
        //     success:(res) => {
        //         let data = res.data;
        //         this.setState({
        //             data:data,
        //         })
        //     }
        // })

    }


    deleteCar(){
        // HttpTemp.post({

        //     url:"/CPage/mycar/logic/delete.php",
        //     data:{
        //         id:this.state.data.id
        //     },
        //     success:(res) => {
        //         Toast.info("删除成功", 1);
        //         //需要回跳
        //     },
        //     error: {
        //         code: (res)=> {
        //             Toast.info(res.msg, 1);
        //         }
        //     }

        // })

    }




    /*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
    render(){
        var windowWidth = Dimensions.get('window').width;
        return(
            <CPage>

                <CContent bg='rgba(248, 248, 248, 1)' mt='96'>

                    <View>

                        {/* 车辆信息标题 */}
                        <CItemX w="750" mx="30" h="80" y="center"> 
                            <CText color="#AEAEAE" size="26">车辆信息</CText>
                        </CItemX>

                        {/* 车辆信息 */}
                        <CItemY  w="750" bg="white">

                            {/* 车牌号码详情 */}
                            <CItemX w="750" px="30" style={{ borderBottomWidth:1, borderBottomColor:"#eee" }}  h="100" y="center"> 
                                <CBetween>
                                    <CText size="30" color="#434343">车牌号码</CText>
                                    <CText size="30" color="#434343">{this.state.data.set_number}</CText>
                                </CBetween>
                            </CItemX>

                        </CItemY>

                        {/* 删除按钮，删除之前会询问用户是否确认删除 */}
                        <CItemY x="center" mt="20">
                            <Button onClick={()=>{
                                Modal.alert('确定要删除吗', '删除后不可恢复', [
                                    { text: '确定', onPress: () => {
                                        this.deleteCar();
                                    }, style:{ color:"#797979" }},
                                    { text: '取消', onPress: () => {}, style:{ color:"#02B349" }},
                                ]);

                            }} style={{ width:windowWidth/24*20, height:40, backgroundColor:"rgba(2, 179, 73, 1)", borderWidth:0}}>
                                <CText size="28" color="white">删除</CText>
                            </Button>
                        </CItemY>

                    </View>

                </CContent>

                {/* 顶部 star */}
                <CHeader h='96' y='center' bg='#fff' style={{ borderBottomColor:"#eee", borderBottomWidth:1 }}>
                    <CBetween px='20'>
                        <CHand  onPress={(e)=> {
                            this.Nav.goBack()
                        }}>
                            <Icon type='left' size='md' color='#00CC66' />
                        </CHand>

                        <CText size='34'>车辆详情</CText>
                        <CHand w='44' h='44'></CHand>
                    </CBetween>
                </CHeader>
                {/* 顶部 star */}

            </CPage>
        )
    }
}

